[#-- freemarker menu demo --]
<style type="text/css">

	/*临时
	body, table, input, textarea, select {
		font-family: 微软雅黑,Verdana,sans-serif,宋体;
	}*/
	
	div.css-menu {
		width:100%;
		float:left;
		font-family: 微软雅黑,Verdana,sans-serif,宋体;
		margin:0;
		padding:0;
	}

</style>

<script type="text/javascript">
	[#-- $(function() {
		var theme = getTheme();
	    $("#topMenu").jqxMenu({ width: '600px', height: '50px', theme: theme });
	    $("#topMenu").css('visibility', 'visible');
	});

	function getTheme() {
		var theme =  $.data(document.body, 'theme');
	    if (theme == null) {
			theme = '';
	    }  else {
	        return theme;
	    }
	    //取得主题
	    theme = '${appConfig["csstheme"]}';
	    var url = "${base}/js/plugins/jqwidgets/styles/jqx." + theme + '.css';
	    if (document.createStyleSheet != undefined) {
	        document.createStyleSheet(url);
	    }  else $(document).find('head').append('<link rel="stylesheet" href="' + url + '" media="screen" />');
	  
	    return theme;
	};--]
</script>
<div class="css-menu m-left" id="topMenu">
	<ul>
		[@buildNode child=menu.subComponents parent=menu /> 
	</ul>
</div>
[#macro buildNode child parent]
	<li><a href="${parent.url}" title="${parent.description}" >${displayer.getMessage("${parent.title}")}</a>
    [#if child?? && child?size gt 0]
		<ul>
		[#list child as t]
			[#if t.subComponents?? && t.subComponents?size gt 0]
				[@buildNode child=t.subComponents parent=t/]
			[#else]
				[#--不存在儿子节点,则不需要递归,只生成父亲节点数据--]
				<li><a href="${t.url}" title="${t.description}" >${displayer.getMessage("${t.title}")}</a></li>
			[/#if] 
		[/#list]
		</ul>
    [/#if]
    </li>
[/#macro]

